#ifndef EPOLLDISPATCHER_H
#define EPOLLDISPATCHER_H

#include "Channel.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string>
#include <sys/epoll.h>
#include "Dispatcher.h"
using namespace std;

class EpollDispatcher : public Dispatcher
{
public:
    EpollDispatcher(EventLoop* evLoop);

    ~EpollDispatcher();

    int add()override;

    int remove()override;

    int modify()override;

    int dispatch(int timeout = 2)override;

private:
    int epollCtl(int op);

private:
    int m_epfd;
    struct epoll_event* m_events;
    const int m_maxNode = 520;
};

#endif // EPOLLDISPATCHER_H
